package com.yikome.uaa.domain;

import java.util.List;

import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import com.yikome.common.BaseEntity;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Setter
@Getter
@NoArgsConstructor
@AllArgsConstructor
@Entity
@EntityListeners(AuditingEntityListener.class)
@Table(name = "u_authority")
public class Authority extends BaseEntity {

	private static final long serialVersionUID = 2416894658483142745L;

	/**
	 * 菜单名称
	 */
	private String name;
    
    /**
	 * 父菜单ID，一级菜单为0
	 */
    private Long parentId;
    
    /**
	 * 菜单URL
	 */
	private String url;
	
	/**
	 * 授权
	 */
	private String value;
	
	/**
	 * 类型     1：目录   2：菜单   3：按钮
	 */
	private Integer type;
	
	/**
	 * 菜单图标
	 */
	private String icon;

	/**
	 * 排序
	 */
	private Integer orderNum;
	
	
	
	public Authority(String name, Long parentId, String url, String value, Integer type, String icon, Integer orderNum) {
		super();
		this.name = name;
		this.parentId = parentId;
		this.url = url;
		this.value = value;
		this.type = type;
		this.icon = icon;
		this.orderNum = orderNum;
	}



	@Transient
	private List<Authority> children;
}
